本文整理汇总了C#中OfficeOpenXml.ExcelWorksheet.Cell方法的典型用法代码示例。如果您正苦于以下问题:C# ExcelWorksheet.Cell方法的具体用法?C# ExcelWorksheet.Cell怎么用?C# ExcelWorksheet.Cell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OfficeOpenXml.ExcelWorksheet的用法示例。
在下文中一共展示了ExcelWorksheet.Cell方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: strNaneColumn
public static string strNaneColumn(int totalColumn, ExcelWorksheet worksheet)
{
int iRow = 1;
string para = null;
for (int iCol = 0; iCol < totalColumn; iCol++)
{
if (worksheet.Cell(iRow, iCol + 1).Value != "")
{
string value = worksheet.Cell(iRow, iCol + 1).Value;
para += (iCol == totalColumn - 1) ? value : value + ',';
}
}
return para.Trim();
}开发者ID:hoanghuynh2409,项目名称:ToolImport,代码行数:14,代码来源:Program.cs
示例2: countColumn
public static int countColumn(ExcelWorksheet worksheet)
{
int totalcell = 0;
do
{
totalcell++;
} while (worksheet.Cell(1, totalcell + 1).Value != "");
return totalcell;
}开发者ID:hoanghuynh2409,项目名称:ToolImport,代码行数:9,代码来源:Program.cs
示例3: SetStyleAddress
private void SetStyleAddress(StyleBase sender, Style.StyleChangeEventArgs e, ExcelAddressBase address, ExcelWorksheet ws, ref Dictionary styleCashe)
{
if (address.Start.Column == 0 || address.Start.Row == 0)
{
throw (new Exception("error address"));
}
//Columns
else if (address.Start.Row == 1 && address.End.Row == ExcelPackage.MaxRows)
{
ExcelColumn column;
//Get the startcolumn
ulong colID = ExcelColumn.GetColumnID(ws.SheetID, address.Start.Column);
if (!ws._columns.ContainsKey(colID))
{
column=ws.Column(address.Start.Column);
}
else
{
column = ws._columns[colID] as ExcelColumn;
}
var index = ws._columns.IndexOf(colID);
while(column.ColumnMin address.End.Column)
{
var newCol = ws.CopyColumn(column, address.End.Column + 1, column.ColumnMax);
column.ColumnMax = address.End.Column;
}
if (styleCashe.ContainsKey(column.StyleID))
{
column.StyleID = styleCashe[column.StyleID];
}
else
{
ExcelXfs st = CellXfs[column.StyleID];
int newId = st.GetNewID(CellXfs, sender, e.StyleClass, e.StyleProperty, e.Value);
styleCashe.Add(column.StyleID, newId);
column.StyleID = newId;
}
index++;
if (index >= ws._columns.Count)
{
break;
}
else
{
column = (ws._columns[index] as ExcelColumn);
}
}
if (column._columnMax < address.End.Column)
{
var newCol = ws.Column(column._columnMax + 1) as ExcelColumn;
newCol._columnMax = address.End.Column;
if (styleCashe.ContainsKey(newCol.StyleID))
{
newCol.StyleID = styleCashe[newCol.StyleID];
}
else
{
ExcelXfs st = CellXfs[column.StyleID];
int newId = st.GetNewID(CellXfs, sender, e.StyleClass, e.StyleProperty, e.Value);
styleCashe.Add(newCol.StyleID, newId);
newCol.StyleID = newId;
}
//column._columnMax = address.End.Column;
}
//Set for individual cells in the spann. We loop all cells here since the cells are sorted with columns first.
foreach (ExcelCell cell in ws._cells)
{
if (cell.Column >= address.Start.Column &&
cell.Column p.Id == ParameterId.ManufacturerSerialNumber).RealValue ?? string.Empty;
sheet.Cell(rowNum, 4).Value = port.ParameterList.Find(p => p.Id == ParameterId.ServerId).RealValue.Replace("-", string.Empty);
var enr = port.ParameterList.Find(p => p.Id == ParameterId.Eigentumsnummer).TargetValue ?? string.Empty;
sheet.Cell(rowNum, 5).Value = string.Format("{0}", enr);
sheet.Cell(rowNum, 6).Value = port.ParameterList.Find(p => p.Id == ParameterId.Typ).TargetValue ?? string.Empty;
sheet.Cell(rowNum, 7).Value = port.ParameterList.Find(p => p.Id == ParameterId.PinCode).TargetValue ?? string.Empty;
rowNum++;
}
}开发者ID:cwschroeder,项目名称:MeterTestComService,代码行数:18,代码来源:ExcelExport.cs
示例12: CreateExcelFileHeader
private static void CreateExcelFileHeader(ExcelWorksheet sheet)
{
sheet.Cell(1, 1).Value = "Prüfplatznummer";
sheet.Cell(1, 2).Value = "PublicKey";
sheet.Cell(1, 3).Value = "Fabriknummer";
sheet.Cell(1, 4).Value = "Server-ID";
sheet.Cell(1, 5).Value = "Eigentumsnummer";
sheet.Cell(1, 6).Value = "Typ";
sheet.Cell(1, 7).Value = "Pin";
}开发者ID:cwschroeder,项目名称:MeterTestComService,代码行数:10,代码来源:ExcelExport.cs
注:本文中的OfficeOpenXml.ExcelWorksheet.Cell方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。
|